<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="df" uri="/WEB-INF/datetag.tld"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>

    <!-- start: Meta -->
    <meta charset="utf-8">
    <title>GM</title>
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="keyword" content="">
    <!-- end: Meta -->

    <!-- start: Mobile Specific -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- end: Mobile Specific -->

    <!-- start: CSS -->
    <link id="bootstrap-style" href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/bootstrap-responsive.min.css" rel="stylesheet">
    <link id="base-style" href="../css/style.css" rel="stylesheet">
    <link id="base-style-responsive" href="../css/style-responsive.css" rel="stylesheet">

    <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <link id="ie-style" href="../css/ie.css" rel="stylesheet">
    <![endif]-->

    <!--[if IE 9]>
    <link id="ie9style" href="../css/ie9.css" rel="stylesheet">
    <![endif]-->

    <!-- start: Favicon -->
    <link rel="shortcut icon" href="../img/favicon.ico">
    <!-- end: Favicon -->

</head>

<body>
<!-- start: Content -->

<div class="row-fluid sortable">
    <div class="box span12">
        <div class="box-header" data-original-title>
            <h2>
                <i class="halflings-icon white user"></i>
                <span class="break"></span>排程管理 (账单编号:${bill.id})
            </h2>
            <a href="../cardOper/gotoAddCardOper.web?blid=${bill.id}">
                <i class="glyphicons-icon circle_plus" style="margin-top: -15px"></i>
            </a>
            <div class="box-icon">
                <a href="#" class="btn-setting">
                    <i class="halflings-icon white wrench"></i>
                </a>
                <a href="#" class="btn-minimize">
                    <i class="halflings-icon white chevron-up"></i>
                </a>
                <a href="#" class="btn-close">
                    <i class="halflings-icon white remove"></i>
                </a>
            </div>
        </div>
        <div class="box-content" style="overflow-y:scroll; overflow-x:scroll; height:980px;">
            <div class="span3 statbox purple" style="height:95px">
                <div class="boxchart">已排消费: ${consume}  /  未排消费: ${bill.repayMoney-consume}</div>
                <div class="boxchart">已排还款: ${repayment}  /  未排还款: ${bill.repayMoney-repayment}</div>
                <c:if test="${bill.repayMoney-consume == 0 && bill.repayMoney-repayment == 0}">
                    <a class="btn btn-info" href="javascript: complete(${bill.id})">
                        <i class="halflings-icon ok"></i> 添加完成排程状态
                    </a>
                </c:if>
                <c:if test="${bill.status == 1}">
                    <a class="btn btn-info" href="javascript: cancel(${bill.id})">
                        <i class="halflings-icon white trash"></i> 取消完成排程状态
                    </a>
                </c:if>
            </div>
            <table class="table table-striped table-bordered bootstrap-datatable datatable">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>账单编号</th>
                    <th>操作类型</th>
                    <th>金额</th>
                    <th>操作时间</th>
                    <th>刷卡编号</th>
                    <th>状态</th>
                    <th>创建时间</th>
                    <%--<th>修改时间</th>--%>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${cardOperList}" var="cardOper" >
                    <tr>
                        <td>${cardOper.id}</td>
                        <td>${cardOper.blid}</td>
                        <td>
                            <c:if test="${cardOper.type==1}">
                                <span class="label label-success">还款</span>
                            </c:if>
                            <c:if test="${cardOper.type==-1}">
                                <span class="label label-warning">消费</span>
                            </c:if>
                        </td>
                        <td>${cardOper.operMoney}</td>
                        <td>
                            <df:date value="${cardOper.operTime}"/>
                        </td>
                        <td>${cardOper.operator}</td>
                        <td id="status_${cardOper.id}">
                            <c:if test="${cardOper.status==1}">
                                <span class="label label-success">已处理</span>
                            </c:if>
                            <c:if test="${cardOper.status==0}">
                                <span class="label label-warning">未处理</span>
                            </c:if>
                            <c:if test="${cardOper.status==-1}">
                                <span class="label label-important">删除</span>
                            </c:if>
                        </td>
                        <td class="center">
                            <df:date value="${cardOper.createTime}"/>
                        </td>
                        <td id="oper_${cardOper.id}" class="center">
                            <c:if test="${cardOper.status == 0}">
                                <a class="btn btn-info" href="javascript: deal(${cardOper.id})">
                                    <i class="halflings-icon ok"></i> 处理
                                </a>
                                <a class="btn btn-danger" href="../cardOper/gotoUpdateCardOper.web?cardOperId=${cardOper.id}">
                                    <i class="halflings-icon white edit"></i>
                                </a>
                            </c:if>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div><!--/span-->

</div><!--/row-->
<!-- start: JavaScript-->

<script src="../js/jquery-1.9.1.min.js"></script>
<script src="../js/jquery-migrate-1.0.0.min.js"></script>

<script src="../js/jquery-ui-1.10.0.custom.min.js"></script>

<script src="../js/jquery.ui.touch-punch.js"></script>

<script src="../js/modernizr.js"></script>

<script src="../js/bootstrap.min.js"></script>
<script>

    var complete = function (id) {
        var url = "../bill/dealed.do?blid=" + id;
        if(window.confirm("确定已经完成这笔账单排程?")){
            $.get(url,function(data,status){
                console.log(data);
                if(data.status == 100){
                    alert("账单已经处于完成状态.");
                }
            });
        }

    }

    var cancel = function (id) {
        var url = "../bill/cancelDeal.do?blid=" + id;
        if(window.confirm("确定取消账单完成排程状态?")){
            $.get(url,function(data,status){
                console.log(data);
                if(data.status == 100){
                    alert("账单已经处于未完成状态.");
                }
            });
        }

    }

    var deal = function (id) {
        var url = "../cardOper/cardOperDeal.do?id=" + id;
        if(window.confirm("该条操作是否已经处理?")){
            $.get(url,function(data,status){
                console.log(data);
                if(data.status == 100){
                    $("#status_"+id).html('<span class="label label-success">已处理</span>');
                    $("#oper_"+id).html("");
                }
            });
        }

    }

</script>

</body>
</html>
